package com.project.controller;

import com.project.bean.GradeBean;
import com.project.bean.RoleBean;
import com.project.service.IGradeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("grade")
@Api(tags = "等级控制器")
public class GradeController {
    @Autowired
    private IGradeService gradeService;
    @ApiOperation("按角色编号数组查询权限")
    @ApiImplicitParam(name="roleIdArr",value = "角色编号数组")
    @RequestMapping("findByRoleList")
    @RequiresPermissions("role:*")
    public List<GradeBean> findByRoleList(Integer[] roleIdArr) {
        return gradeService.findByRoleList(roleIdArr);
    }
    @ApiOperation("查询所有权限")
   @RequestMapping("findAll")
    @RequiresPermissions("role:*")
    public List<GradeBean> findAll() {
        return gradeService.findAll();
    }
}
